#include <stdlib.h>
#include <string.h>

char *_ocd_strndup(const char *s, size_t n)
{
	size_t len = strlen(s);
    char *new;

	if (len > n)
	    len = n;
	new = malloc(len + 1);

	if (!new)
		return NULL;

	new[len] = '\0';
	return (char *) memcpy(new, s, len);
}
